package linwen.wang.guava.eventbus;


import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.EventBus;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName EventBusConfiguration
 * @Description eventBusConfiguration
 * @Author lin
 * @Date 2021/11/5 下午11:29
 * @Version V1.0
 */
@Configuration
public class EventBusConfiguration {

    @Bean
    public EventBus eventBus(){
         return new EventBus();
    }

    @Bean
    public AsyncEventBus asyncEventBus(){
        return new AsyncEventBus(command -> {
            Thread thread = new Thread(command);
            thread.setName("一个新线程");
            thread.start();
        });
    }



}
